﻿using System;

using SharpOSCAR.Base;

namespace SharpOSCAR.Snac.OSERVICE
{
    /// <summary>
    /// This message is sent by the client once it has initialized the server state
    /// (set preferences, Buddy Lists, locate information, capabilities) and is ready
    /// to be announced as being online by the server.
    /// </summary>
    /// <remarks>
    /// The client may have used groups not in groupVersions during initialization, but
    /// once this SNAC has been received by the server, SNACs in groups not specified in
    /// groupVersions will be rejected. Other users will not see this user online until
    /// this SNAC is sent.
    /// </remarks>
    public class OSERVICE__CLIENT_ONLINE : SNAC__Header
    {
        private DataArray _SupportedFoodgroups;

        /// <summary>
        /// Initializes the OSERVICE__CLIENT_ONLINE SNAC
        /// </summary>
        /// <param name="requestId">SNAC request ID</param>
        public OSERVICE__CLIENT_ONLINE(uint requestId)
            : base(1, 2, 0, requestId)
        {
            _SupportedFoodgroups = new DataArray();
            _SupportedFoodgroups.Add(new OSERVICE__Version(SNAC__FOODGROUPS.OSERVICE, 4));
            _SupportedFoodgroups.Add(new OSERVICE__Version(SNAC__FOODGROUPS.FEEDBAG, 3));
            _SupportedFoodgroups.Add(new OSERVICE__Version(SNAC__FOODGROUPS.BUDDY, 1));
            _SupportedFoodgroups.Add(new OSERVICE__Version(SNAC__FOODGROUPS.ICBM, 1));
            SnacPayload = _SupportedFoodgroups;
        }
    }
}
